﻿@{
    Layout = null;
}

<!DOCTYPE html>
@model ElingOA6_Admin_DSJCJ.Model.ItemRequisitionApply
<html>
<head>
    <title></title> 
 

  @if (false)
   {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
   }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/regex.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>

    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)

         <script>
             if (top.boardtop) {
                 top.boardtop.head_txt.innerText = "物品领用登记";
             }
    </script>
<script>
    $(document).ready(function () {
        $("#toolMenu").smartFloat();
        var hdjsAlert = $("#hdjsAlert").val();
        if (hdjsAlert != "") {
            if (hdjsAlert == "操作成功") {
                alert(hdjsAlert);
                window.location.href = rootPath + "/Admin/OfficeItemUseAppay/Index";
            }
            else {
                alert(hdjsAlert);
            }
        }
    });

    function popDialog(itemNo) {
        window.showModalDialog(rootPath + "/Admin/OfficeItemPurchaseApply/OfficeItemPurchaseApplyAddEntryInfo?itemNo=" + itemNo, 'popDialog', 'dialogWidth:500px;dialogHeight:220px');
        //window.location.href = rootPath + "/Admin/OfficeItemPurchaseApply/OfficeItemPurchaseApplyAddEntryInfo?itemNo=" + itemNo;
    }

//    function clearNoNum(obj) {
//        //先把非数字的都替换掉，除了数字和.
//        obj.value = obj.value.replace(/[^\d.]/g, "");
//        //必须保证第一个为数字而不是.
//        obj.value = obj.value.replace(/^\./g, "");
//        //保证只有出现一个.而没有多个.
//        obj.value = obj.value.replace(/\.{2,}/g, ".");
//        //保证.只出现一次，而不能出现两次以上
//        obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
//    }

    function delRow(rowId) {
        $("#" + rowId).remove();
    }
    function itemChoose() {
        var openUrl = rootPath + "/Admin/Dialog/OfficeItemManagerDialog"; //弹出窗口的url
        var iWidth = 500; //弹出窗口的宽度;
        var iHeight = 550; //弹出窗口的高度;
        var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //获得窗口的垂直位置;
        var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; //获得窗口的水平位置;
        window.open(openUrl, "", "height=" + iHeight + ", width=" + iWidth + ", top=" + iTop + ", left=" + iLeft);
    }

    function Show(nos) {
        $.ajax({
            type: 'POST',
            url: rootPath + '/Admin/OfficeItemUseAppay/ClickShow',
            data: { itemClsNos: nos, z: $("#hdselectIndex").val() },
            success: function (result) {
                var list = result.split('|');
                $("#position").append(list[0]);
                $("#hdselectIndex").val(list[1]);
            }
        });
    }

    function OK() {
        form1.submit();
    }

    function MenuTop_emClick(source, e) {
        switch (e.item.name) {
            case "btnSave":
                {
                    //保存
                    OK();
                    break;
                }
            case "btnCancel":
                {
                    window.location.href = rootPath + "/Admin/OfficeItemUseAppay/Index";
                    break;
                }
        }
    }

    function QueryEmp(e,s) {
        var returnValue = window.showModalDialog(rootPath + "/Admin/Dialog/EmpLeaveTree", "", "dialogWidth=300px;dialogHeight=500px");
        if (typeof (returnValue) != "undefined") {

            var Value = JSON.parse(returnValue);
            $.ajax({
                type: 'POST',
                url: rootPath + '/Admin/OfficeItemUseAppay/QueryEmp',
                data: { no: Value[0].Value },
                success: function (result) {
                    if (result != "") {
                        var Value2 = JSON.parse(result);;
                        FApplyEmplName.SetText(Value2.FEmpName);
                        FApplyDeptName.SetText(Value2.FDeptName);
                        $("#hdFApplyEmplNo").val(Value2.FEmplNo);
                        $("#hdFApplyDeptNo").val(Value2.FDeptNo);
                    }
                }
            });    
        }
    }
</script>
</head>
<body>
@using (Html.BeginForm("Save", "OfficeItemUseAppay", FormMethod.Post, new { id = "form1" }))
{
     <div class="floatToolMenu" id="toolMenu">
        @Html.DevExpress().Menu(settings =>
   {
       settings.Name = "toolBarMenu";
       settings.ItemAutoWidth = false;
       settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
       settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
       settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);
       settings.Items.Add(item =>
       {
           item.Name = "btnSave";
           item.Text = "保存";
           item.ClientEnabled = true;
           item.Image.Url = Url.Content("~/Content/ControlImages/filesave.png");

       });
       settings.Items.Add(item =>
       {
           item.Name = "btnCancel";
           item.Text = "取消";
           item.ClientEnabled = true;
           item.Image.Url = Url.Content("~/Content/ControlImages/no.png");

       });
       settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
       settings.ItemLinkMode = ItemLinkMode.ContentBounds;
   }).GetHtml()
   </div>
    <div>
  <table width="100%" align="center" class="tableForm" border="0">
            <tr>
                <th align="right" class="tdClass">申请单号:</th>
                <th style=" text-align:left">
                    @Html.DevExpress().Label(settings =>
               {
                   settings.Name = "FItemRequisitionApplyID";
                   settings.Text = Model.FItemRequisitionApplyID == 0 ? "待生成..." : Model.FItemRequisitionApplyID.ToString();
                   settings.Properties.Style.ForeColor = System.Drawing.Color.Red;
               }).GetHtml()
                </th>
                 <th align="right">填报人:</th>
                <th style=" text-align:left">
                    @Html.DevExpress().Label(settings =>
               {
                   settings.Name = "FInsEmplNo";
                   settings.Text = Model.FInsEmplNo;
               }).GetHtml()
                </th>
            </tr>
                        <tr>
                <th align="right" class="tdClass">申请人:</th>
                <th style=" text-align:left">
                <table width="100%">
                <tr>
                <td>
                 @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FApplyEmplName";
                   settings.Text = Model.FApplyEmplName;
                   settings.ReadOnly = true;
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(99);
               }).GetHtml()
                </td>
                <td>
               @Html.DevExpress().Button(settings =>
               {
                   settings.Name = "btnEmpName";
                   settings.Text = "选择";
                   settings.ClientSideEvents.Click = "    function (e,s) {QueryEmp(e,s)}";
               }).GetHtml()
                </td>
                </tr>
                </table>
                </th>
    @Html.Hidden("hdFApplyEmplNo", Model.FApplyEmplNo)
                 <th align="right">部门:</th>
                <th style=" text-align:left">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FApplyDeptName";
                   settings.Text = Model.FApplyDeptName;
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(45);
                   settings.ReadOnly = true;
               }).GetHtml()
                </th>
    @Html.Hidden("hdFApplyDeptNo", Model.FApplyDeptNo)        
            </tr>
             <tr>
                <th align="right" class="tdClass" style=" width:10%">备注:</th>
                <td colspan="5">
                    @Html.DevExpress().Memo(settings =>
               {
                   settings.Name = "FApplyReason";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(99);
                   settings.Height = 60;
                   settings.Text = Model.FApplyReason;
                   settings.Enabled = true;
                   settings.Properties.Rows = 3;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
                </td>
            </tr>
            <tr>
                <td colspan="6" class="tdClass">

                <table id="position" width="100%" align="center" border="0" class="tableForm">
                   <tr>
                        <th width="20%" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "操作"; settings.Properties.Style.Font.Bold = true; }).GetHtml()</th>
                        <th width="20%" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "用品名称"; settings.Properties.Style.Font.Bold = true; }).GetHtml()</th>
                        <th width="20%" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "单价"; settings.Properties.Style.Font.Bold = true; }).GetHtml()</th>
                        <th width="20%" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "库存"; settings.Properties.Style.Font.Bold = true; }).GetHtml()</th>
                        <th width="20%" style =" text-align:center">@Html.DevExpress().Label(settings => { settings.Text = "申请数量"; settings.Properties.Style.Font.Bold = true; }).GetHtml()</th>
                    </tr>   
                    @Html.Raw(ViewData["ShowList"].ToString())
                </table>  
                    <div style="text-align:center">
                    @Html.DevExpress().Button(settings =>
               {
                   settings.Name = "btnItem";
                   settings.Text = "选择办公用品";
                   settings.ControlStyle.CssClass = "center";
                   //settings.Images.Image.Url = Url.Content("~/Content/ControlImages/item.png");
                   settings.ClientSideEvents.Click = "function(){itemChoose()}";
               }).GetHtml()
                        
                    </div>     
                </td>
            </tr>
    </table>
    @Html.Hidden("hdjsAlert", (ViewData["jsAlert"]))
    @Html.Hidden("hdtype", ViewData["type"])        
    @Html.Hidden("hdselectIndex", ViewData["selectIndex"])      
    @Html.Hidden("hdfItemRequisitionApplyID", ViewData["fItemRequisitionApplyID"])     
    </div>
}
</body>
</html>
